<?php
/* @var $this CmpDepositController */
/* @var $model CmpDeposit */

$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'客户服务'=>array($this->pre_module_url.'/cmpServices/admin'),
	'退款管理'=>array($this->pre_module_url.'/refund/admin'),
	'退款详细'
);

?>

<div class="hr_15"></div>
<div class="steps">
	<ul class="fs_14 c_f">
		<li class="done done_b first"><span class="one">第一步,买家申请退款</span></li>
		<li class="done_a"><span class="two">第二步，卖家处理退款申请</span></li>
		<li class="cur_last"><span class="three">第三步，退款成功</span></li> 
	</ul>
</div>
<div class="hr_20"></div>
<!--退款管理 start-->
<div class="refund_box step_box">
	<!--已发货退款  start-->
	<div class="step_info ">
		<div class="step_status">
			<div class="status">
				<p><span class="ico_big ico_done"></span>
					<strong class="fs_14">
						<?php if($model->zr_pay_status==2){
							echo "退款失败";
						}elseif($model->zr_pay_status==4){
							echo "退款成功,资金已转到对方支付帐号！";
						}?>
					</strong>
				</p>
			</div>
			<ul class="form_list">
				<li class="c_f"><span class="tit f_l">退款凭证：</span>
					<div class="cert_img f_l">
						<ul class="c_f">
						<li><?php echo CHtml::image(!empty($model->zr_cmp_pic[0])?$model->zr_cmp_pic[0]:"/images/cert_img.jpg")?></li>
						<li><?php echo CHtml::image(!empty($model->zr_cmp_pic[1])?$model->zr_cmp_pic[1]:"/images/cert_img.jpg")?></li>
						<li><?php echo CHtml::image(!empty($model->zr_cmp_pic[2])?$model->zr_cmp_pic[2]:"/images/cert_img.jpg")?></li>
						</ul>
					</div>
				</li>
				<li><span class="tit">说明：</span><span><?php echo CHtml::encode($model->zr_cmp_re)?></span></li>
			</ul>
		</div>
		<?php if($model->zr_return==2){?>
		<div class="info">
			<h3>物流信息</h3>
			<ul class="form_list">
				<li><span class="tit">物流公司：</span><span><?php echo Express::model()->getExpressCom($model->zr_exp_name)?></span></li>
				<li><span class="tit">运单号码：</span><span><?php echo CHtml::encode($model->zr_exp_code)?></span></li>
				<li><span class="tit">物流信息：</span><span id="expinfo"></span></li>
			</ul>
		</div>
		<?php }?>
		<ul class="form_list">
			<li><span class="tit">退款编号：</span><span><?php echo $model->zr_id?></span></li>
			<li><span class="tit">申请退款时间：</span><span><?php echo date('Y-m-d H:i',$model->inputtime)?></span></li>
			<li><span class="tit">退款类型：</span>
				<span>
					<?php if($model->zr_order_status==1){
						echo "卖家未发货";
					}elseif($model->zr_order_status==2){
						echo "卖家已发货，买家未收到货";
					}elseif($model->zr_order_status==3){
						echo "买家已收到货，需退货";
					}?>
				</span>
			</li>
			<li><span class="tit">退款状态：</span>
				<span>
					<?php if($model->zr_pay_status==1&&$model->zr_order_status==1){
						echo "卖家未发货，买家申请退款。等待卖家确认";
					}elseif($model->zr_pay_status==1&&$model->zr_order_status==2){
						echo "卖家已发货，买家未收到货,买家申请退款，等待买家确认";
					}elseif($model->zr_pay_status==1&&$model->zr_order_status==3){
						echo "买家已收到货,申请退款，等待买家确认是否需要退货，或直接退款";
					}elseif($model->zr_pay_status==3&&$model->zr_return==1){
						echo "卖家同意退款，等待买家退货";
					}elseif($model->zr_pay_status==3&&$model->zr_return==2){
						echo "买家已退货，等待卖家确认收货并退款";
					}elseif($model->zr_pay_status==4){
						echo "退款成功";
					}elseif($model->zr_pay_status==2){
						echo "退款失败";
					}
					?>
				</span>
			</li>
			<li><span class="tit">需要退款金额：</span><span><strong class="c_f60"><?php echo $model->zr_amount?></strong> 元</span></li>
			<li><span class="tit">退款原因：</span><span><?php echo CHtml::encode(Refund::model()->getReason($model->zr_reason))?></span></li> 
			<li class="c_f"><span class="tit f_l">退款凭证：</span>
				<div class="cert_img f_l">
					<ul class="c_f">
						<li><?php echo CHtml::image(!empty($model->zr_user_pic[0])?$model->zr_user_pic[0]:"/images/cert_img.jpg")?></li>
						<li><?php echo CHtml::image(!empty($model->zr_user_pic[1])?$model->zr_user_pic[1]:"/images/cert_img.jpg")?></li>
						<li><?php echo CHtml::image(!empty($model->zr_user_pic[2])?$model->zr_user_pic[2]:"/images/cert_img.jpg")?></li>
					</ul>
				</div>
			</li>
			<li><span class="tit">退款说明：</span><span><?php echo CHtml::encode($model->zr_content)?></span></li>
		</ul>          
	</div>
	<!--已发货退款  end -->
	<table class="list_table" cellpadding="0" cellspacing="0" width="100%">
		<tr>
			<th width="35%">宝贝信息</th>
			<th width="15%">卖家</th>
			<th width="12%">单价（元）</th>
			<th width="12%">数量</th>
			<th width="14%">优惠</th>
			<th width="12%">小计（元）</th>
		</tr>
		<?php if(empty($model->zop_id)){?>
		<tr>
			<td class="pro tl">
				<div class="c_img c_img50">
					<?php echo CHtml::link(Tool::thumb($model->ordproduct->zop_pic,50,50),array('/home/product/detail','id'=>$model->ordproduct->zp_id),array('style'=>'display: inline; width: 50px; height: 50px;'))?>
				</div>
				<p class="title_pro">
					<?php echo CHtml::link(mb_substr($model->ordproduct->zop_title,0,20),array('/home/product/detail','id'=>$model->ordproduct->zp_id),array('class'=>'c_06c'))?>
				</p>
			</td>
			<td>
				<a class="c_06c" href="javascript:" title=""><?php echo $model->ordproduct->member->zm_name?></a>
			</td>
			<td><?php echo $model->ordproduct->zop_price?></td>
			<td><?php echo $model->ordproduct->zop_nums?></td>
			<td><span class="agio"><?php echo number_format(($model->ordproduct->zop_price*$model->ordproduct->zop_nums)/$model->ordproduct->zop_real_price*10,1,'.','')?>折优惠</span></td>
			<td><span class="fw_b fs_14 c_f60"><?php echo $model->ordproduct->zop_real_price?></span></td>
		</tr>
		<?php }else{foreach($model->order->orderProduct as $val)?>
		<tr>
			<td class="pro tl">
				<div class="c_img c_img50">
					<?php echo CHtml::link(Tool::thumb($val->zop_pic,50,50),array('/home/product/detail','id'=>$val->zp_id),array('style'=>'display: inline; width: 50px; height: 50px;'))?>
				</div>
				<p class="title_pro">
					<?php echo CHtml::link(mb_substr($val->zop_title,0,20),array('/home/product/detail','id'=>$val->zp_id),array('class'=>'c_06c'))?>
				</p>
			</td>
			<td>
				<a class="c_06c" href="javascript:" title=""><?php echo $val->member->zm_name?></a>
			</td>
			<td><?php echo $val->zop_price?></td>
			<td><?php echo $val->zop_nums?></td>
			<td><span class="agio"><?php echo number_format(($val->zop_price*$val->zop_nums)*10/$val->zop_real_price,1,'.','')?>折优惠</span></td>
			<td><span class="fw_b fs_14 c_f60"><?php echo $val->zop_real_price?></span></td>
		</tr>
		<?php } ?>
	</table>
</div>
<!--退款管理 end-->
<script type="text/javascript">
//物流信息
$(document).ready(function()
		{
				$("#expinfo").html('loading...');
				var expressid = '<?php echo $model->zr_exp_name?>';
	            var expressno = '<?php echo $model->zr_exp_code?>';
				$.get("/snoopy/express",{com:expressid,nu:expressno},
					function(data)
					{
					$("#expinfo").html(data);
					}
				); 
		});
</script>

